<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>仪表盘 - FinalCMS Admin</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<link rel="stylesheet" href="${ctx}/css/bootstrap.min.css" />
<link rel="stylesheet" href="${ctx}/css/font-awesome.min.css" />
<link rel="stylesheet" href="${ctx}/css/jquery-ui.custom.min.css" />
<link rel="stylesheet" href="${ctx}/css/fc-fonts.css" />
<link rel="stylesheet" href="${ctx}/css/fc.min.css" />
<link rel="stylesheet" href="${ctx}/css/jquery.gritter.css" />
<!--[if lte IE 9]>
	<link rel="stylesheet" href="${ctx}/css/fc-part2.min.css" />
<![endif]-->
<link rel="stylesheet" href="${ctx}/css/fc-skins.min.css" />
<link rel="stylesheet" href="${ctx}/css/fc-rtl.min.css" />

<!--[if lte IE 9]>
  <link rel="stylesheet" href="${ctx}/css/fc-ie.min.css" />
<![endif]-->

<!--[if lte IE 8]>
<script src="${ctx}/js/html5shiv.js"></script>
<script src="${ctx}/js/respond.min.js"></script>
<![endif]-->

	<!--[if !IE]> -->
	<script type="text/javascript">
		window.jQuery
				|| document.write("<script src='${ctx}/js/jquery2.1.0.min.js'>"
						+ "<"+"/script>");
	</script>
	<!-- <![endif]-->

	<!--[if IE]>
	<script type="text/javascript">
	 	window.jQuery || document.write("<script src='${ctx}/js/jquery1.11.0.min.js'>"+"<"+"/script>");
	</script>
	<![endif]-->
</head>

<body class="no-skin">
	<?include("../../inc/menu.html",{current:"post_article"}){}?>
	<div class="main-content">
		<div class="breadcrumbs" id="breadcrumbs">
			<script type="text/javascript">
				try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
			</script>

			<ul class="breadcrumb">
				<li><i class="ace-icon fa fa-home home-icon"></i> <a
					href="${ctx}/admin/index">首页</a></li>
				<li class="active">文章类型</li>
			</ul>
			<div class="nav-search" id="nav-search">
				<form class="form-search">
					<span class="input-icon"> <input type="text"
						placeholder="Search ..." class="nav-search-input"
						id="nav-search-input" autocomplete="off" /> <i
						class="ace-icon fa fa-search nav-search-icon"></i>
					</span>
				</form>
			</div>
		</div>

		<div class="page-content">
			<?include("../../inc/function.html"){}?>
			<div class="page-header">
				<h1>文章类型</h1>
			</div>
			<!-- /.page-header -->
			<div class="row">
				<form action="/admin/contentType/saveContentType" id="frm" method="post">
					<div class="alert alert-success" style="padding: 5px; margin-bottom: 0px;">
							<span> <label for="typeNameCN">分类名称</label> 
								<input type="text" name="fContentType.type_name_cn" id="typeNameCN" autocomplete="off" data-rel="tooltip" data-placement="top" data-original-title="中文分类名" placeholder="中文分类" />
							</span>&nbsp;&nbsp;&nbsp;&nbsp; 
							<span> <label for="typeNameEN">英文名称</label> 
								<input type="text" name="fContentType.type_name_en" id="typeNameEN" autocomplete="off" data-rel="tooltip" data-placement="top" data-original-title="英文分类名" placeholder="英文分类" />
							</span>&nbsp;&nbsp;&nbsp;&nbsp; 
							<span><label for="status">状态</label> 
								<#fc:select data="${@org.yi.fc.enums.PostStatusEnum.values()}" id="status" name="fContentType.type_status" valueName ="name" displayName="desc" selectedValue="${fContentType.type_status!'启用'}"   />
							</span>&nbsp;&nbsp;&nbsp;&nbsp; 
							<span>
								<input type="hidden" name="cms_token" value="${cms_token!''}">
								<input type="submit" class="btn btn-app" style="font-size:14px; line-height: 1em;" value="保存" class="search" />
							</span>
					</div>
				</form>	
		<? if(exist("page") && page != null){ ?>	
			<form action="/admin/contentType/updateTypeStatus" method="POST" id="typeFrm">	
				<div class="table-container col-xs-12" style=" border: 1px; padding: 5px 1px; left: 0; richness: 0;">
					<table id="content-table"
						class="table table-striped table-bordered table-hover"
						style="margin-bottom: 0;">
						<thead>
							<tr>
								<th class="center sorting_disabled" role="columnheader" rowspan="1" colspan="1" aria-label="">选择</th>
								<th class="center">编号</th>
								<th class="center">中文类型名称</th>
								<th class="center">英文类型名称</th>
								<th class="center">状态</th>
								<th class="center">创建时间</th>
								<th class="center">创建人</th>
								<th class="center">操作</th>
							</tr>
						</thead>
						<tbody>
							<#fc:foreach data="${page.list!}" ; list,index>
							<tr>
								<td class="center">
								<label class="position-relative">
									<input type="checkbox" class="ace table_check" name="content_id" value="${list.id!}">
									<span class="lbl"></span>
								</label></td>
								<td class="center">${list.id!}</td>
								<td class="center">${list.type_name_cn!}</td>
								<td class="center">${list.type_name_en!""}</td>
								<td class="center">${list.type_status!}</td>
								<td class="center">${list.create_time!}</td>
								<td class="center">${list.user_id!}</td>
								<td class="center">
									<div class="hidden-sm hidden-xs action-buttons">
										<!-- 查看 -->
										<a href="javascript:void(0)"  class="blue view-type" artile-data="${list.id!}">
											 <i class="ace-icon fa fa-search-plus bigger-130" title="查看"></i>
										</a> 
										<!-- 禁用 -->
										
										<a href="javascript:void(0)"   class="dark forbid-type" artile-data="${list.id!}" status-data="${list.typeStatus}"> 
											<i class="ace-icon ${list.typeStatus == '启用' ? 'fa fa-ban light-grey' : 'glyphicon glyphicon-ok green'} bigger-130" title="${list.typeStatus == '启用' ? '禁用' : '启用'}"></i>
										</a>
										<!-- 删除 -->
										<a href="javascript:void(0)"  class="red del-type" artile-data="${list.id!}"> 
											<i class="ace-icon fa fa-trash-o bigger-130" title="删除"></i>
										</a>
									</div>
								</td>
							</tr>
							</#fc:foreach>
						</tbody>
					</table>
					<#fc:pagination page="${page!}" opgroup="false" formId="typeFrm" delfun="delContents" forbidfun="forbidContents" repubfun="repubContents" />
				</div>
		<? } ?>		
		<input type="hidden" name="typeId" /><input type="hidden" name="typeStatus" />
			</form>
		</div>
	</div>
		<!-- /.page-content -->
</div>
	<!-- /.main-content -->

	<?include("../../inc/footer.html"){}?>
	
	<script type="text/javascript">
		if ('ontouchstart' in document.documentElement)
			document
					.write("<script type='text/javascript' src='${ctx}/js/jquery.mobile.custom.min.js'>"
							+ "<"+"/script>");
	</script>
	<script type="text/javascript" src="${ctx}/js/bootstrap.min.js"></script>

	<!--[if lte IE 8]>
		  <script type="text/javascript" src="${ctx}/js/excanvas.min.js"></script>
	<![endif]-->
	
	<!-- 消息提示框插件 -->
	<script type="text/javascript" src="${ctx}/js/jquery.gritter.min.js"></script>
	<script type="text/javascript" src="${ctx}/js/fc-extra.min.js"></script>
	<script type="text/javascript" src="${ctx}/js/fc.min.js"></script>
	<script type="text/javascript" src="${ctx}/js/utils/util.js"></script>
	<script type="text/javascript">
		var contentStatusEN = "${fcontent.contentStatusEN!}";
		jQuery(function(){
			
			if("${msg!}" != ''){
				$.gritter.add({
					title:  '提示' ,
					sticky: false, //提示框是否不消失
					text: "${msg!}",
					class_name: 'gritter-center ' + ("${msgStatus!'1'}" == '1' ? "gritter-success" : "gritter-error")
				});
		    }
			
			$('[data-rel=tooltip]').tooltip();
			
			//新增文章类型时，绑定form表单的提交事件
			$("#frm").submit(function(){
				var typeNameCN = $.trim($("#typeNameCN").val());
				if($.isEmptyObject(typeNameCN)){
					$("#typeNameCN").addClass("tooltip-error").attr("data-original-title","中文分类名称不能为空").trigger("mouseenter")
					return false;
				}else{
					return true;
				}
			});
			
			//点击禁用图标
			$(".forbid-type").on("click",function(){
				var status = $(this).attr("status-data");
				var index = $(this).attr("artile-data");
				
				$("#typeFrm").submit(function(){
					$("input[name='typeId']").val(index);
					$("input[name='typeStatus']").val(status == "启用" ? "禁用" : "启用");
					return true;
				}).trigger("submit");
				
			});
			
			
		});
		
		
	</script>
	
</body>
</html>
